/**
 * \class CSpaceMonitorThread
 * \brief This is a thread to monitor the spaces' status in the cube cluster.
 * \version 0.3.2
 *
 * \author Woo-Hyun Kim (woorung@nhncorp.com, woorung@gmail.com)
 * \author http://blog.naver.com/wisereign .
 *
 * \date 2007/10/9
 */
#ifndef CSpaceMonitorThreadH
#define CSpaceMonitorThreadH

#include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <algorithm>
#include <fstream>
#include <string>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <stdexcept>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <signal.h>

#include "common_space.h"
#include "thread/CThread.h"
#include "CDiscoveryProxy.h"

using namespace std;
//---------------------------------------------------------------------------
class CSpaceMonitorThread : public CThread {
private :
	long data_count;

	string host;
	int port;

	CServiceInfo *space_info;

	cube__CService target_space;

	void run();

protected :
	virtual void monitor();

public :
	CSpaceMonitorThread(char *name);
	virtual ~CSpaceMonitorThread();

	bool workspace(const char *service, const char *instance);
	void add(CServiceInfo *space_info);
	void add(char *host, int port);

	long size();
};
//---------------------------------------------------------------------------
#endif
